﻿using System;
using System.Collections.Generic;
using System.Web.Mvc;
using Microsoft.Practices.EnterpriseLibrary.Validation.Configuration;

namespace ElValWeb.ValidatorClientAdapters {
    public class NotNullValidatorClientAdapter : BaseClientAdapter<NotNullValidatorData> {

        public NotNullValidatorClientAdapter(NotNullValidatorData validatorData)
            : base(validatorData) {
        }

        public override IEnumerable<ModelClientValidationRule> GetClientRules(Type ownerType) { 
            return new []{Negate(new ModelClientValidationRequiredRule(ValidatorData.GetMessageTemplate()), ValidatorData.Negated)};
        }
    }
}
